const express = require('express');
const router = express.Router();

const sequelize = require('../configs/sequelize_config');
const BizProduct = require('../models/product_model');

/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});

router.get('/product', async function(req, res, next) {
  try {
    /*const result = await sequelize.query('select * from biz_product', {
      type: 'SELECT'
    });*/

    const result = await BizProduct.findAll();

    res.send({
      result
    });
  } catch (error) {
    res.send(error);
  }
});

module.exports = router;
